﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LPY.LeHealth.DTO;


namespace LPY.LeHealth.DAL 
{
    using ServiceStack.OrmLite;
   public  class Physcal: GenericBaseDAL<PhysicalType>
    {
       /// <summary>
       /// 显示全部类型
       /// </summary>
       /// <returns></returns>
       public List<PhysicalType> showall()
       {
           
           using (var cnn = DbConnection)
           {

               var rtv = cnn.Select<PhysicalType>().ToList();
               return rtv;
           }
       }
       /// <summary>
       /// 体检指南类别显示前5条
       /// </summary>
       /// <returns></returns>
       public List<PhysicalType> showPhysical()
       {
           using (var cnn = DbConnection)
           {

               var rtv = cnn.Select<PhysicalType>()
                    .Take(5).ToList();
               return rtv;
           }
       }
       /// <summary>
       /// 类别显示5条以后的
       /// </summary>
       /// <returns></returns>
       public List<PhysicalType> getendall()
       {
        using (var cnn = DbConnection)
           {

               var rtv = cnn.Select<PhysicalType>()
                    .Skip(5).ToList();
               return rtv;
           }
       }
       /// <summary>
       /// 添加类别
       /// </summary>
       /// <param name="ph"></param>
       /// <returns></returns>
       public long add(PhysicalType ph)
       {
           using (var cnn = DbConnection)
           {
               var tid = cnn.Insert<PhysicalType>(ph, selectIdentity: true);
               return tid;
           }
       }
    }
}
